const app = getApp()
const cookieUtil = require("../../utils/manager_cookie.js")
Page({
  data: {
	clubUsers:[]
  },
  onLoad(options) {
	const clubId = options.clubId
	const url = app.globalData.baseUrl + app.globalData.clubUserUrl
	const cookie = cookieUtil.getCookieFromStorage().data
	let headers = {
		cookie
	}
	let data = {
		clubId,
	}
		
	let promise = new Promise((resolve, reject) => {
	
		let headers = {}
		headers.cookie = cookie
	
		my.request({
			url,
			method: "GET",
			data,
			headers,
			success: (res) => {
				resolve(res)
			}
		})
	})
	
	promise.then((res) => {
		console.log(res)
		//如果未登录则进行跳转
		if (res.data.code == "fail") {
			cookieUtil.setCookieToStorage("")
			app.globalData.managerStatus = false
			my.redirectTo({
				url: "/pages/manager_login/manager_login"
			})
		}
		let clubUsers = res.data.data
		this.setData({
			clubUsers
		})
		
	})
    my.setCanPullDown({
      canPullDown: false
    })
  },
});